package com.hui.mapper;

import com.hui.entity.Role;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Description
 */
public class RoleMapper implements RowMapper<Role> {
    @Override
    public Role rowToEntity(ResultSet rs) {
        Role role = null;

        try {
            int roleId = rs.getInt("role_id");
            String roleName = rs.getString("role_name");
            String roleDesc = rs.getString("role_desc");
            role = new Role(roleId, roleName, roleDesc);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return role;
    }
}
